package net.zozoo.ioc.di;

import org.junit.jupiter.api.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class BookTest {
    @Test
    public void testBook() {
        //通过xml set方式注入对象属性
        ApplicationContext context = new ClassPathXmlApplicationContext("book-di.xml");
        Book book = (Book) context.getBean("book");
        System.out.println(book);
    }

    @Test
    public void testBook2() {
        //通过xml 构造器方式注入对象属性
        ApplicationContext context = new ClassPathXmlApplicationContext("book-di.xml");
        Book book = (Book) context.getBean("bookCon");
        System.out.println(book);
    }
}
